//
//  MainTableController.m
//  OCDemo
//
//  Created by BH on 15/9/24.
//  Copyright © 2015年 baohan. All rights reserved.
//

#import "MainTableController.h"
#import "FirListController.h"
#import "LabListController.h"
#import "RefreshController.h"
#import "ShenSuoTableController.h"
#import "ContactController.h"
#import "ContactController2.h"
#import "ORCodeController.h"
#import "FmdbController.h"
#import "AFNController.h"
#import "ShopCartController.h"
#import "GlobalDefine.h"

@interface MainTableController ()
{
    NSArray *tableList;
}

@property (strong, nonatomic) IBOutlet UITableView *myTable;

@end

@implementation MainTableController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _myTable.separatorInset = UIEdgeInsetsMake(0, 0, 0, 10);
    tableList = [NSArray arrayWithObjects:@"tableview下拉放大图片",@"MLLabel图文混排",@"Refresh刷新",@"点击按钮伸缩tableview Cell",@"仿通讯录",@"二维码生成与扫描",@"fmdb数据库操作",@"AFN & Cache",@"购物车",nil];
    
    _myTable.tableFooterView = [[UIView alloc] init];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return tableList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *identiy = @"MainCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identiy forIndexPath:indexPath];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identiy];
    }
    
    cell.textLabel.text = tableList[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        
        PUSH(CONTROLLER_FROM_STORYBOARD(@"FirListController"));
        
    }else if (indexPath.row == 1){

        PUSH(CONTROLLER_FROM_STORYBOARD(@"LabListController"));
        
    }else if (indexPath.row == 2){

        PUSH(CONTROLLER_FROM_STORYBOARD(@"RefreshController"));

    }else if (indexPath.row == 3){

        PUSH(CONTROLLER_FROM_STORYBOARD(@"ShensuoTableController"));
        
    }else if (indexPath.row == 4){

        PUSH(CONTROLLER_FROM_STORYBOARD(@"ContactController"));
        
    }else if (indexPath.row == 5){
 
        PUSH(CONTROLLER_FROM_STORYBOARD(@"ORCodeController"));
        
    }else if (indexPath.row == 6){
    
        PUSH(CONTROLLER_FROM_STORYBOARD(@"FmdbController"));
        
    }else if (indexPath.row == 7){

        PUSH(CONTROLLER_FROM_STORYBOARD(@"AFNController"));
    }else if (indexPath.row == 8){
        
        PUSH([[ShopCartController alloc] init]);
    }
}


@end
